import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;


public class Player {
	private int[] scores;
	private final int BEAR = 0, DEER = 1, BUNNY = 2;
	private BufferedImage icon;
	private int xpos, ypos, width, height;
	private int bullets;
	private Random rand;
	
	public Player(int bullets) {
		this.scores = new int[3];
		this.bullets = bullets;
		this.rand = new Random();
	}
	
	public void kill(Animal animal, boolean dead) {
		if (animal instanceof Bear && !dead)
			scores[BEAR]++;
		else if (animal instanceof Deer && !dead)
			scores[DEER]++;
		else if (animal instanceof Bunny && !dead)
			scores[BUNNY]++;
	}
	
	public int getBullets() {
		return bullets;
	}
	
	public void shoot() {
		bullets--;
	}
	
	public int[] getScores() {
		return scores;
	}
	
	public int getBearKills() {
		return scores[BEAR];
	}
	
	public int getDeerKills() {
		return scores[DEER];
	}
	
	public int getBunnyKills() {
		return scores[BUNNY];
	}
	
	public int calculateMeat() {
		// starts meat at 0
		int meat = 0;
		
		for(int i=0; i<getBearKills(); i++) {
			int temp = rand.nextInt(100)+1;
			meat += temp;
		}
		
		for(int i=0; i<getDeerKills(); i++) {
			int temp = rand.nextInt(50)+1;
			meat += temp;
		}
		
		for(int i=0; i<getBunnyKills(); i++) {
			int temp = rand.nextInt(10)+1;
			meat += temp;
		}
		
		return meat;
	}
	
	public String toString() {
		String temp = "";
		temp += "Bears: ";
		temp += scores[BEAR]+", ";
		temp += "Deer: ";
		temp += scores[DEER]+", ";
		temp += "Bunnys: ";
		temp += scores[BUNNY];
		return temp;
	}
	
	

}
